<?

require(dirname(__FILE__).'/_base/BaseTaskComment.php');

class TaskComment extends BaseTaskComment{
    
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }
    
    public function rules() {
        return array(
            array('user_id, task_id, time_create, text', 'required'),
            array('parent_id, user_id, task_id, time_create', 'numerical', 'integerOnly'=>true),
            array('id, parent_id, user_id, task_id, time_create, text', 'safe', 'on'=>'search'),
        );
    }
    
    public function relations() {
        return array(
            'com_author' => array(self::BELONGS_TO, 'TaskUser', 'user_id'),
            'com_children' => array(self::HAS_MANY, 'TaskComment', 'parent_id'),
        );
    }
    
    public function attributeLabels() {
        return array(
            'id' => TaskModule::t('fields', 'ID'),
            'parent_id' => TaskModule::t('fields', 'Родительский комментарий'),
            'user_id' => TaskModule::t('fields', 'Пользователь'),
            'task_id' => TaskModule::t('fields', 'задача'),
            'time_create' => TaskModule::t('fields', 'Дата создания'),
            'text' => TaskModule::t('fields', 'Текст'),
        );
    }
    
}
